package com.wx.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.wx.dao.SysWxuserMapper;
import com.wx.entity.SysWxuser;
import com.wx.entity.SysWxuserExample;
import com.wx.service.SysWxuserService;

@Service("SysWxuserService")
public class SysWxuserImpl implements SysWxuserService {
	@Resource
	private SysWxuserMapper sysWxuserMapper;

	@Override
	public int insert(SysWxuser sysWxuser) {
		return sysWxuserMapper.insert(sysWxuser);
	}

	@Override
	public List<SysWxuser> selectByExample(SysWxuserExample example) {
		return sysWxuserMapper.selectByExample(example);
	}
	@Override
	public SysWxuser selectByWxid(String  wxid){
		SysWxuserExample example = new SysWxuserExample();
		example.createCriteria().andWxidEqualTo(wxid);
		PageHelper.startPage(1,1);
		List<SysWxuser> list = sysWxuserMapper.selectByExample(example);
		if(list !=null && list.size() > 0)
			return list.get(0);
		else
		return null;
	}
	
	@Override
	public SysWxuser selectByPrimaryKey(Integer id) {
		return sysWxuserMapper.selectByPrimaryKey(id);
	}
	@Override
	public int countByExample(SysWxuserExample example) {
		return sysWxuserMapper.countByExample(example);
	}
	@Override
	public int updateByExample(SysWxuser record, SysWxuserExample example) {
		return sysWxuserMapper.updateByExample(record, example);
	}
	@Override
	public int updateByPrimaryKey(SysWxuser record) {
		return sysWxuserMapper.updateByPrimaryKey(record);
	}
	@Override
	public int deleteByPrimaryKey(Integer id) {
		return sysWxuserMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int deleteByPrimaryKey(SysWxuserExample example) {
		return sysWxuserMapper.deleteByExample(example);
	}

	@Override
	public int updateByPK(SysWxuser record) {
		return sysWxuserMapper.updateByPrimaryKeySelective(record);
	}
}
